package org.jarraiders.musiclibrary.client.view;

import org.jarraiders.musiclibrary.client.presenter.LeftPanelPresenter;

import com.google.gwt.core.client.GWT;
import com.google.gwt.resources.client.CssResource;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.History;
import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;

public class LeftPanel extends Composite implements LeftPanelPresenter.Display {
	interface LeftPanelStyle extends CssResource{
		String enable();
		String disable();
		
	}

	private static LeftPanelUiBinder uiBinder = GWT
			.create(LeftPanelUiBinder.class);

	interface LeftPanelUiBinder extends UiBinder<Widget, LeftPanel> {
	}

	@UiField
	Anchor Artists;
	@UiField
	Anchor Albums;
	@UiField
	Anchor Tracks;
	
	public LeftPanel() {	
		
		initWidget(uiBinder.createAndBindUi(this));
	}
	
	
	

	@Override
	public void getSelectedItem() {
		String token=History.getToken();
		if (token.equals("list")){		
			Artists.setStyleName("a");
			Albums.setStyleName("a");
			Tracks.setStyleName("a");
			
		}
		if (token.equals("list_artist")){
			
			Artists.setStyleName("a b-current");
			Albums.setStyleName("a");
			Tracks.setStyleName("a");
			
		}
		if (token.equals("list_album")){
			
			Artists.setStyleName("a");
			Albums.setStyleName("a b-current");
			Tracks.setStyleName("a");
		}
		if (token.equals("list_track")){
			
			Artists.setStyleName("a");
			Albums.setStyleName("a");
			Tracks.setStyleName("a b-current");
		}		
	}

	

}
